from gssgca.transmission_line.multi_weather_sag import sag_under_multiple_weathers
from gssgca.crossing.system_analysis import analyze_crossing_system, accident_dynamic_tension
from gssgca.utils.construction_report import render_markdown_report


def main() -> None:
    weather_cases = [
        {"name": "高温", "temp_C": 45},
        {"name": "覆冰10mm", "temp_C": -5, "ice_mm": 10},
        {"name": "大风0.6kPa", "temp_C": 5, "wind_kPa": 0.6},
    ]
    pts = sag_under_multiple_weathers(
        span_m=420,
        unit_weight_kN_m=0.0048,
        elastic_modulus_MPa=73000,
        area_mm2=300,
        alpha_per_C=1.9e-5,
        temp_ref_C=15,
        initial_tension_kN=20,
        conductor_diameter_mm=21.6,
        weather_cases=weather_cases,
    )
    sys = analyze_crossing_system(total_vertical_kN=120, total_horizontal_kN=60, beam_span_m=18)
    peak = accident_dynamic_tension(static_tension_kN=30)
    report = render_markdown_report(
        "跨越-多气象与整体受力示例",
        {
            "天气点数量": len(pts),
            "立柱轴力(kN)": round(sys.column_axial_kN, 1),
            "横梁弯矩(kNm)": round(sys.beam_bending_kNm, 1),
            "拉线张力(kN)": round(sys.guy_tension_kN, 1),
            "事故峰值张力(kN)": round(peak.peak_tension_kN, 1),
        },
    )
    print(report)


if __name__ == "__main__":
    main()


